<html>
<head><meta charset="utf-8"><title>lazy norm + object safety · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html">lazy norm + object safety</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198260641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198260641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198260641">(May 20 2020 at 21:40)</a>:</h4>
<p>Working on <a href="https://github.com/rust-lang/rust/issues/72219">#72219</a> part 1: Object safety interactions with constants</p>
<p>I managed to find a way to use the currently missing object safety check to achieve greatness (aka segfaults) <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span> </p>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(const_generics)]</span><span class="w"></span>
<span class="cp">#![feature(const_type_id, core_intrinsics)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Const</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">([</span><span class="o">&amp;</span><span class="nb">&#39;static</span><span class="w"> </span><span class="kt">u32</span><span class="p">;</span><span class="w"> </span><span class="n">N</span><span class="p">]);</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">A</span>: <span class="nb">&#39;static</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Const</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="n">std</span>::<span class="n">intrinsics</span>::<span class="n">type_id</span>::<span class="o">&lt;</span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">u8</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">usize</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">&#39;static</span><span class="o">&gt;</span><span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Const</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="n">std</span>::<span class="n">intrinsics</span>::<span class="n">type_id</span>::<span class="o">&lt;</span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">u8</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">usize</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Const</span><span class="p">([</span><span class="o">&amp;</span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="n">std</span>::<span class="n">intrinsics</span>::<span class="n">type_id</span>::<span class="o">&lt;</span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">u8</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="kt">usize</span><span class="p">])</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="nc">dyn</span><span class="w"> </span><span class="n">A</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="mi">7</span><span class="k">i32</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">A</span>::<span class="n">foo</span><span class="p">(</span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="c1">// A is not object safe, as the return type of `foo` depends on `Self`.</span>
<span class="w">    </span><span class="c1">// This is unsound.</span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;{:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">foo</span><span class="p">.</span><span class="mi">0</span><span class="p">[</span><span class="o">..</span><span class="p">]);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="198260676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198260676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198260676">(May 20 2020 at 21:40)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="121053">@varkor</span> on how to actually check unevaluated consts for object safety violations.</p>



<a name="198260795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198260795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198260795">(May 20 2020 at 21:42)</a>:</h4>
<p>Do we want to walk the MIR of the const argument to check if it uses self?</p>



<a name="198262569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198262569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198262569">(May 20 2020 at 22:01)</a>:</h4>
<p>Thinking about this a bit more, I am not completely sure if this is well formed <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span><br>
So this test may stop relying on object safety checking once <a href="https://github.com/rust-lang/rust/pull/70107">https://github.com/rust-lang/rust/pull/70107</a> is merged.</p>



<a name="198302394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198302394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198302394">(May 21 2020 at 09:38)</a>:</h4>
<p>Hmm.</p>



<a name="198302429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198302429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198302429">(May 21 2020 at 09:39)</a>:</h4>
<p>So my <em>assumption</em>, which I realize now was flawed or at least non-obvious, is that we would want to limit references to <code>Self</code> by constants apart from something like <code>&lt;Self as Trait&lt;..&gt;&gt;::Constant</code></p>



<a name="198302446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198302446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198302446">(May 21 2020 at 09:39)</a>:</h4>
<p>But I realize that -- at least with our current setup -- we don't have visibility into that, or at least we'd have to inspect the MIR or something</p>



<a name="198302457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198302457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198302457">(May 21 2020 at 09:39)</a>:</h4>
<p>Which I guess is your point</p>



<a name="198302464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198302464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198302464">(May 21 2020 at 09:39)</a>:</h4>
<p>Welp <em>that's</em> going to be annoying</p>



<a name="198345963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198345963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198345963">(May 21 2020 at 16:51)</a>:</h4>
<p>Would it be possible to only mention needed subst of <code>ConstKind::Unevaluated</code> during construction,<br>
so instead of identity substs in <a href="https://github.com/rust-lang/rust/blob/06c9fef822b890054fcefa9a567b57eb6edfe638/src/librustc_middle/ty/sty.rs#L2273">https://github.com/rust-lang/rust/blob/06c9fef822b890054fcefa9a567b57eb6edfe638/src/librustc_middle/ty/sty.rs#L2273</a> we try to only add actually used params?</p>



<a name="198346058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198346058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198346058">(May 21 2020 at 16:52)</a>:</h4>
<p>This would also allow me to fix <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/substs.20of.20Unevaluated.20consts/near/198163517">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/substs.20of.20Unevaluated.20consts/near/198163517</a> by simply checking for cycles in generalize/equate.</p>



<a name="198346172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198346172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198346172">(May 21 2020 at 16:53)</a>:</h4>
<p>This would mean that the object safety check is slightly conservative, but tbh I feel fine with that <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="198355754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198355754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198355754">(May 21 2020 at 18:09)</a>:</h4>
<p>that would certainly solve various problems</p>



<a name="198355758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198355758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198355758">(May 21 2020 at 18:09)</a>:</h4>
<p>it seems like it should be possible</p>



<a name="198355778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198355778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198355778">(May 21 2020 at 18:09)</a>:</h4>
<p>at minimum we could special case "simple" constants like <code>22</code></p>



<a name="198355799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198355799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198355799">(May 21 2020 at 18:09)</a>:</h4>
<p>and/or path-based constants like <code>X</code> or <code>T::Foo</code></p>



<a name="198355809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198355809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198355809">(May 21 2020 at 18:09)</a>:</h4>
<p>(Do those require <code>{...}</code> syntax?)</p>



<a name="198356850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198356850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198356850">(May 21 2020 at 18:18)</a>:</h4>
<p>Paths do require braces unless they are only 1 segment and not in the type namespace.</p>



<a name="198356913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198356913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198356913">(May 21 2020 at 18:18)</a>:</h4>
<blockquote>
<p>at minimum we could special case "simple" constants like 22</p>
</blockquote>
<p>We already do <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span>, which is why <code>7</code> sometimes works where <code>{ 7 }</code> doesn't.</p>



<a name="198356965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198356965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198356965">(May 21 2020 at 18:19)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/06c9fef822b890054fcefa9a567b57eb6edfe638/src/librustc_middle/ty/sty.rs#L2241">https://github.com/rust-lang/rust/blob/06c9fef822b890054fcefa9a567b57eb6edfe638/src/librustc_middle/ty/sty.rs#L2241</a></p>



<a name="198357134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198357134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198357134">(May 21 2020 at 18:20)</a>:</h4>
<p>I don't think braces are problematic, as we can just unwrap them in <code>Const::from_anon_const</code>.</p>



<a name="198357405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198357405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198357405">(May 21 2020 at 18:22)</a>:</h4>
<p>Afaict we have to minimize substs using <code>Hir</code>, as <code>optimized_mir</code> probably causes cycle errors here</p>



<a name="198357567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198357567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198357567">(May 21 2020 at 18:24)</a>:</h4>
<p>A good thing is that afaik consts can only depend on generic params if they explicitly mention them, so this may be implementable using a rather simple hir Visitor</p>



<a name="198358119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198358119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198358119">(May 21 2020 at 18:29)</a>:</h4>
<p>^ I would like some confirmation for the last point so I don't miss some strange edge case which breaks this approach after it's already in use</p>



<a name="198474804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198474804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198474804">(May 22 2020 at 18:05)</a>:</h4>
<p>Simply discarding irrelevant substs does not work, as we currently use indexing in a bunch of places, not sure how much we rely on this though,<br>
as ICE tend to stop any further execution <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="198475087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198475087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198475087">(May 22 2020 at 18:08)</a>:</h4>
<p>Two possible ways I can think of are to either update the <code>generics_of</code> query for AnonConst.</p>



<a name="198475425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198475425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198475425">(May 22 2020 at 18:12)</a>:</h4>
<p>I am not sure how well this would work,. We rely on <code>Generics.parent</code> for relevant parameters which we have to stop doing as consts may only depend on some of the defined params.</p>



<a name="198475623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198475623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198475623">(May 22 2020 at 18:14)</a>:</h4>
<p>The other option would be to use a bunch of duct tape everywhere substs are used. This seems like a horrible idea though<br>
(edit: this is slightly too negative, I don't yet know how complicated this would be)</p>



<a name="198476119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198476119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198476119">(May 22 2020 at 18:18)</a>:</h4>
<p>Note that while object safety can be fixed without touching substs, I don't think there is a different solution which allows us to fix  <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/substs.20of.20Unevaluated.20consts/near/198163517">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/substs.20of.20Unevaluated.20consts/near/198163517</a></p>



<a name="198493507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198493507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198493507">(May 22 2020 at 20:51)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> I'll try to schedule some time to get back to you on this, I feel like I need to sit down and think a bit about it</p>



<a name="198493527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198493527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198493527">(May 22 2020 at 20:51)</a>:</h4>
<p>might be useful to find some time to talk about it together</p>



<a name="198500725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/198500725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#198500725">(May 22 2020 at 22:12)</a>:</h4>
<p>I only have a few weekly lectures and can spend the rest of my time fairly liberally atm. It should be fairly<br>
easy to find a date which works for me.</p>



<a name="199086328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/199086328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#199086328">(May 28 2020 at 21:03)</a>:</h4>
<p>ping <span class="user-mention" data-user-id="116009">@nikomatsakis</span>. Is this still on your radar?</p>



<a name="199093291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/199093291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#199093291">(May 28 2020 at 22:19)</a>:</h4>
<p>/me checks Niko's radar <a href="/user_uploads/4715/U6bHNrsRgbbwyq-eU4VPLfhB/radar.jpeg">radar.jpeg</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/U6bHNrsRgbbwyq-eU4VPLfhB/radar.jpeg" title="radar.jpeg"><img src="/user_uploads/4715/U6bHNrsRgbbwyq-eU4VPLfhB/radar.jpeg"></a></div>



<a name="199093374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/lazy%20norm%20%2B%20object%20safety/near/199093374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/lazy.20norm.20.2B.20object.20safety.html#199093374">(May 28 2020 at 22:20)</a>:</h4>
<p><span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>